
def compute_gains(open,close):
    close=close if close else 1
    open=open if open else 1
    if -0.001<((close-open)/open)*100<0.001:
        result=2
    elif ((close-open)/open)*100>=0.001:
        result=1
    else:
        result=3
    return '{0:.3%}'.format((close-open)/open),result

